#pragma once
#include <Rz/Object.h>
#include "IEventCallback.h"

namespace Rz {

class EventCallbackMethodPointer
    : public Object
	, public IEventCallback
{
    public:
		RZ_RTTI(Rz, EventCallbackMethodPointer);
		RZ_RTTI_IMPLEMENTS(Object, IEventCallback);
		RZ_RTTI_END;

        template <typename T, typename ArgsT>
        EventCallbackMethodPointer(Object* object, void (T::*callback)(Object&, ArgsT))
            : _object(object)
            , _callback(reinterpret_cast<IEventCallback::MethodFunctionType>(callback))
        {
            RZ_EVENT_CHECK_ARGUMENT_ERROR;
        }

        virtual void Callback(Object& sender, EventArgs& e) override;

    private:
        Object* _object;
        IEventCallback::MethodFunctionType _callback;
};

}
